The Scala-REPL + MMT as a lightweight mathematical user interface
نویسندگان
چکیده
Scala is a general purpose programming language that includes a read-eval-print loop (REPL). Mmt is a general representation language for formal mathematical knowledge implemented in Scala. Independent recent developments permit combining them into an extremely simple user interface that can act as a nucleus for a variety of systems. Firstly, Scala introduced string interpolation – a convenient syntax that permits escaping back and forth between strings and arbitrary Scala expressions (while preserving type safety). Secondly, Mmt introduced a notation-based text syntax and a rule-based evaluation engine for its mathematical objects (which are based on OpenMath). Combining these, users can enter and work with Mmt objects in the Scala-REPL with so little overhead that it essentially behaves like a dedicated Mmt-REPL – except for also providing the full power of Scala. Implicit conversions (e.g., between integers represented in Mmt and Scala integers) further blur the distinction between metaand object language. Mmt is highly extensible: Users can add new type systems and logics as well as new theories and notations and evaluation rules. Thus, we obtain a REPL-style interface for any language represented in Mmt with essentially no effort. 1 Representing Languages in MMT Mmt [RK13] is a generic, formal module system for mathematical knowledge and is a basis for foundation-independent knowledge representation. The Mmt language is designed to be applicable to a large collection of declarative formal base languages and all Mmt notions are fully abstract in the choice of the base language. Therefore, Mmt focuses on foundation-independence, scalability and modularity. Every Mmt declaration is identified by a canonical, globally unique URI. Mmt symbol declarations subsume most semantically relevant statements in declarative mathematical languages including function and predicate symbols, type and universe symbols, and — using the Curry-Howard correspondence — axioms, theorems, and inference rules. Their syntax and semantics is determined by the foundation, in which Mmt is parametric. The Mmt API [Rab13] is a Scala-based [OSV07] open source implementation of the Mmt language and of a number of knowledge management services for it. Declaring Symbols A theory declaration T = {Sym∗} introduces a theory with name T containing a list of symbol declarations. A symbol declaration c : ω = ω′ # ν introduces a symbol named c with type ω, definiens ω′ and notation ν (all of which are optional). Terms ω over a theory T are formed from symbols OMS(T?c) declared in T , bound variables OMV(x), applications OMA(ω, ω1, . . . , ωn) of a function ω to a sequence of arguments, bindings OMBIND(ω,X, ω′) using a binder ω, a bound variable context X, and a scope ω′ as well as integers OMI(i) and floats OMF(f) where i and f are integers and floats, respectively. This is a fragment of the OpenMath language [BCC04]. Remark 1. For readability we will write T?c instead of OMS(T?c) in the following. Furthermore, we will write c instead of T?c when the theory T is clear from the context. Example 1. Figure 1 shows an Mmt theory Lists, based on the logical framework LF [HHP93]. Lists declares natural numbers and lists as well as additional operations on them (plus for naturals and append for lists). Using the Mmt notation language, described below, we also declare the usual notations: infix + , :: and ::: for plus, cons, and append, respectively. theory Lists meta LF tp : type tm : tp → type # tm A1 nat : tp zero : tm nat # o succ : tm nat → tm nat # s A1 plus : tm nat → tm nat → tm nat # A1 + A2 list : tp → tm nat → tp # list A1 A2 nil : {A} tm list A zero cons : {A,N} tm A → tm list A N → tm list A (s N) # A3 :: A4 append : {A,M,N} tm list A M → tm list A M → tm list A (M + N) # A4 ::: A5 Fig. 1. Theory declaration in Mmt Remark 2. The theory Lists from Figure 1 has the theory LF as meta-theory which means that all symbols and notations declared in LF are available and can be used in Lists. Specifically, in Lists, we use the symbols for type, arrow (with notation A1 → A2), and the Pi binder (with notation { V1 } S2) all of which are declared in LF with the corresponding notations. Adding Notations Notations act as the parsing and printing rules that transform between abstract syntax and text-based concrete syntax (that supports
منابع مشابه
Work-in-progress: An MMT-Based User-Interface
The Mmt language constitutes a scalable representation and interchange format for formal mathematical knowledge. It is foundation-independent and permits natural representations of the syntax and semantics of virtually all declarative languages. This is leveraged in the Mmt API, which provides a variety of generic logical and knowledge management services. In this work-in-progress report, we pr...
متن کاملThe MMT API: A Generic MKM System
The Mmt language has been developed as a scalable representation and interchange language for formal mathematical knowledge. It permits natural representations of the syntax and semantics of virtually all declarative languages while making Mmt-based MKM services easy to implement. It is foundationally unconstrained and can be instantiated with specific formal languages. The Mmt API implements t...
متن کاملRings: an efficient Java/Scala library for polynomial rings
In this paper we briey discuss Rings — an ecient lightweight library for univariate and multivariate polynomial arithmetic over arbitrary coecient rings. Basic algebra, GCDs and factorization of polynomials are implemented with the use of modern asymptotically fast algorithms. Rings provides a clean API for algebra and a fully typed hierarchy of mathematical structures. Scala API additionall...
متن کاملReview and comparison of User Interface Characteristics of (Springer, Elsevier, Ebsco, ISI(WOS) and Ovid) as Perceived by University of Tehran Users
Background and Aim: The present investigation intends to compare and review various user interfaces from user standpoint and to ascertain its linkage with user satisfaction. Method: The research incorporated a descriptive survey of University of Tehran graduate student body. Using a targeted sampling, graduate students from the faculties of chemistry and Biology were selected. The instruments u...
متن کاملUser Interface Design in Mobile Educational Applications
Introduction: User interfaces are a crucial factor in ensuring the success of mobile applications. Mobile Educational Applications not only provide flexibility in learning, but also allow learners to learn at any time and any place. The purpose of this article is to investigate the effective factors affecting the design of the user interface in mobile educational applications. Methods: Quantita...
متن کاملذخیره در منابع من
با ذخیره ی این منبع در منابع من، دسترسی به آن را برای استفاده های بعدی آسان تر کنید
عنوان ژورنال:
دوره شماره
صفحات -
تاریخ انتشار 2013